/*
 * Copyright 2009 Johnson Consulting Services
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * 
 */
package com.johnsoncs.gwt.widgets.samples.server.db;

import org.apache.empire.data.DataType;
import org.apache.empire.db.DBColumn;
import org.apache.empire.db.DBDatabase;
import org.apache.empire.db.DBTable;
import org.apache.empire.db.DBTableColumn;

/**
 * @author wilj
 *
 */
public class MockDB extends DBDatabase {

	public static class MyRows extends DBTable {
		public final DBTableColumn MYROW_ID;
		public final DBTableColumn FIRST_NAME;
		public final DBTableColumn LAST_NAME;
		public final DBTableColumn STATUS;

		public MyRows(final DBDatabase db) {
			super("MYROWS", db);
			// ID
			MYROW_ID = addColumn("MYROW_ID", DataType.AUTOINC, 0, true, "MYROW_ID_SEQUENCE");
			FIRST_NAME = addColumn("FIRST_NAME", DataType.TEXT, 40, true);
			LAST_NAME = addColumn("LAST_NAME", DataType.TEXT, 40, true);
			STATUS = addColumn("STATUS", DataType.BOOL, 0, true);

			// Primary Key
			setPrimaryKey(MYROW_ID);
			// Set other Indexes
			addIndex("MYROW_ID_IDX", true, new DBColumn[] { MYROW_ID });
		}
	}

	// Declare all Tables and Views here
	public final MyRows MYROWS = new MyRows(this);

	public MockDB() {
		// Define Foreign-Key Relations
	}
}
